package tcp;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TcpDictServer extends TcpEchoServer{
    public TcpDictServer(int port) throws IOException {
        super(port);
    }

    @Override
    public String process(String request) {
        Map<String,String> map = new HashMap<>();
        map.put("cat","小猫");
        map.put("dog","小狗");
        map.put("chicken","小鸡");
        return map.getOrDefault(request,"您要查找的单词不存在");
    }

    public static void main(String[] args) throws IOException {
        TcpDictServer server = new TcpDictServer(9090);
        server.start();
    }
}
